﻿#region 命名空间

using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sharp.Domain.PlatformBoundedContext.PermissionModule.Aggregates;

#endregion

namespace Sharp.Domain.PlatformBoundedContext.ModelConfigurations
{
    public partial class AvailablePermissionTypeConfiguration
        : EntityTypeConfiguration<AvailablePermission>
    {
        public AvailablePermissionTypeConfiguration()
        {
            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            Property(t => t.Code)
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.Title)
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.Category)
                .HasMaxLength(20)
                .IsRequired();

            Property(t => t.ParentId)
                .IsOptional();

            Property(t => t.OrderIndex)
                .IsRequired();

            Property(t => t.Route)
                .IsUnicode(false).HasMaxLength(255)
                .IsOptional();

        }
    }
}